home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-13 | 3.2 KB | 95 lines |
- /*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for NON-COMMERCIAL purposes and without
- * fee is hereby granted provided that this copyright notice
- * appears in all copies. Please refer to the file "copyright.html"
- * for further important copyright and licensing information.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- */
- /*
- * @(#)DemoApplet.java 1.1 96/11/23
- *
- * (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
- * (C) Copyright IBM Corp. 1996 - All Rights Reserved
- *
- * Portions copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
- *
- * The original version of this source code and documentation is copyrighted
- * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
- * materials are provided under terms of a License Agreement between Taligent
- * and Sun. This technology is protected by multiple US and International
- * patents. This notice and attribution to Taligent may not be removed.
- * Taligent is a registered trademark of Taligent, Inc.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for NON-COMMERCIAL purposes and without
- * fee is hereby granted provided that this copyright notice
- * appears in all copies. Please refer to the file "copyright.html"
- * for further important copyright and licensing information.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- *
- */
-
-
- import java.applet.Applet;
- import java.awt.*;
-
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
-
- public abstract class DemoApplet extends java.applet.Applet implements ActionListener
- {
- private Button demoButton;
- private Frame demoFrame;
-
- public abstract Frame createDemoFrame(DemoApplet applet);
-
- //Create a button that will display the demo
- public void init()
- {
- // setBackground(Color.white);
- demoButton = new Button("Demo");
- // demoButton.setBackground(Color.yellow);
- demoButton.addActionListener(this);
- add( demoButton );
- }
- public static void showDemo(Frame demoFrame)
- {
- demoFrame.setSize(550,500);
- demoFrame.show();
- }
-
- public void demoClosed()
- {
- demoFrame = null;
- }
-
- public void actionPerformed(ActionEvent event)
- {
- demoButton.setLabel("loading");
-
- if (demoFrame == null) {
- demoFrame = createDemoFrame(this);
- showDemo(demoFrame);
- } else
- demoFrame.show();
-
- demoButton.setLabel("Demo");
- }
- }
-
-